package com.tc.socket.mq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

import java.util.Map;

/*
 * @author uv
 * @date 2018/9/15 18:36
 *
 */
//@Component
@Slf4j
public class ConsumerService {

    public ConsumerService(){
        System.out.println("init ConsumerService");
    }

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    // 使用JmsListener配置消费者监听的队列，其中name是接收到的消息
    // SendTo 会将此方法返回的数据, 写入到 OutQueue 中去.
    // @SendTo("SQueue")
    @JmsListener(destination = "tianchao.ActiveMQQueue")
    public void handleMessage(String msg) {
        log.info("成功接收: {}" + msg);
        // return "成功接受Name" + msg;
    }
}
